@extends('admin::layouts.master')
@section('content')
    <form action="{{route('addRole',$admin['id'])}}" method="post">
        @csrf
    <div class="col-lg-12">
        <div class="card card-flat">
            <div class="card-header">为[{{$admin['name']}}]设置角色</div>
            <div class="card-body">
                <div class="form-group row pt-1 pb-1">
                    <div class="col-12 col-sm-8 col-lg-6 form-check mt-2">
                        @foreach($roles as $v)
                        <label class="custom-control custom-checkbox custom-control-inline">
                            @if($admin->hasAnyRole($v['name']))
                            <input type="checkbox" checked name="name[]" value="{{$v['name']}}" class="custom-control-input">
                            @else
                            <input type="checkbox" name="name[]"   value="{{$v['name']}}" class="custom-control-input">
                            @endif
                            <span class="custom-control-label">{{$v['title']}}</span>
                        </label>
                        @endforeach

                    </div>
                </div>

            </div>
            <div class="card-footer">
                <button class="btn btn-primary btn-lg">保存</button>
            </div>
        </div>
    </div>
    </form>
@endsection
